
const { program } = require('commander');


function collect(value, previous) {
  return previous.concat([value]);
}

program
  .argument('<numbers>', 'this is a number')
  .argument('<array>', 'this is arr', 9)
  .option('-t, --times <times...>', 'this is a number', collect,[])
  .action(async (numbers, array, options) => {
    await main(numbers, array, options.times);
  })

  program.parseAsync(process.argv)
  .then(() => {
    console.log('DONE');
    process.exit(0);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

async function main(numbers, array, times) {
  console.log('numbers=' + numbers);
  console.log('numbers=' + array);
  console.log('array=' + times);
  const time = times[0];
  console.log('time=' + time);
}